package org.skipper.douyin.controller;

import javafx.fxml.FXML;
import javafx.scene.control.Label;
import org.skipper.douyin.util.DouyinWsUtil;
import org.skipper.douyin.util.DouyinWsUtil2;

import java.io.IOException;

public class HelloController {
    @FXML
    private Label welcomeText;

    @FXML
    protected void onHelloButtonClick() throws Exception {
        // 创建新线程并启动
        Thread thread = new Thread(() -> {
            try {
                // 连接到 WebSocket 服务器
                DouyinWsUtil2.openRoom("TCG9599",welcomeText);
            } catch (InterruptedException e) {
                e.printStackTrace();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        });
        thread.start();

    }
}